<template>
    <div class="content-right">
    	<card shadw>
    		<Form :model="formItem" :label-width="150" ref="formValidate" :rules="ruleValidate">
		        <FormItem label="考场名称：" prop="name">
		        	<Row>
		        		<Col span="11">
		           	 		<Input v-model="formItem.input" placeholder="请输入名称"></Input>
		           	 	</Col>
		            </Row>
		        </FormItem>
		        <FormItem label="绑定考试试卷：" prop="mail" getList="getList()">
		        	<Row>
		        		<Col span="11"class="exam">
				            <Select  placeholder="请选择绑定考试正式试卷">
				                <Option v-for="v in data1" :value="v.name">{{v.name}}</Option>
				            </Select>
				     	</Col>
		            </Row>
		        </FormItem>
		        <FormItem label="考试时段："prop="city">
		            <Row>
		                <Col span="11"class="exam">
		                	<DatePicker type="datetimerange" split-panels placeholder="请选择时间" v-model="formItem.date"></DatePicker>
		                </Col>
		            </Row>
		        </FormItem>
		        <FormItem label="交卷后是否显示分数：" prop="gender">
		            <RadioGroup v-model="formItem.radio"class="exam">
		                <Radio label="true">显示</Radio>
		                <Radio label="flase">不显示</Radio>
		            </RadioGroup>
		        </FormItem>
		         <FormItem label="交卷后是否归档：" prop="interest">
		            <RadioGroup v-model="formItem.radio1"class="exam">
		                <Radio label="true">直接归档</Radio>
		                <Radio label="flase">手动归档</Radio>
		            </RadioGroup>
		        </FormItem>
		         <FormItem label="是否启用：" prop="interest" v-model="single">
		            <RadioGroup v-model="formItem.radio2"class="exam">
		                <Radio label="true">启用</Radio>
		                <Radio label="flase">关闭</Radio>
		            </RadioGroup>
		        </FormItem>
				<FormItem>
		            <Button type="primary" @click="modal1 = true">保存</Button>
		            <Modal
				        v-model="modal1"
				        title="提示"
				        @on-ok="ok"
				        @on-cancel="cancel">
				        <p>考场添加完成，是否立即前往【考场配置-考生管理】，导入考生信息。</p>
				    </Modal>
		            <router-link :to="{name:'examination-set'}"><Button type="ghost" style="margin-left: 8px">取消</Button></router-link>
		        </FormItem>
   			</Form>
    	</card>
    </div>
</template>
<script>
import Cookies from 'js-cookie';
export default {
    data() {
        return {
    	 	formItem: {
                input: '',
                select: '',
                radio:'male',
                radio1:'male',
                radio2:'male',
                checkbox: [],
                switch: true,
                date: '',
                time: '',
                slider: [20, 50],
                textarea: '',
            },
            single: false,
            data1:'',
            ruleValidate: {
                name: [
                    { required: true, message: '请输入名称', trigger: 'blur' }
                ],
                mail: [
                    { required: true, message: '请选择绑定考试正式试卷', trigger: 'blur' },
                    { type: 'email', message: '请选择绑定考试正式试卷', trigger: 'blur' }
                ],
                city: [
                    { required: true, message: '请选择时间段', trigger: 'change' }
                ],
                gender: [
                    { required: true, message: '请选择', trigger: 'change' }
                ],
                interest: [
                    { required: true, type: 'array', min: 1, message: '请选择', trigger: 'change' },
                    { type: 'array', max: 2, message: '请选择', trigger: 'change' }
                ],
                date: [
                    { required: true, type: 'date', message: '请选择', trigger: 'change' }
                ],
            },
            modal1: false
        }
    },
//  新增绑定考试试卷
    created:function(){
    	var that=this;
    	that.axios({
			method:"get",
			url:that.$store.state.app.globalUrl+"/admin/TestPaper/index?size=9999",
			data:{
			}
		}).then(function(res){
			that.data1=res.data.data.list
		})
    },
    methods: {
//  	模态框确定按钮
		ok () {
            this.$Message.info('');
            this.$router.push({
            	name:"examinee-management"
            })
            console.log(this.$router)
        },
//      模态框取消按钮
        cancel () {
            this.$Message.info('');
            this.$router.push({
            	name:"examination-set"
            })
        },	
    }
};
</script>
<style scoped>

</style>